package com.xfy.mybatis.mapper;

import com.xfy.mybatis.pojo.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created by xiexie on 2017-9-3.
 */

public interface UserMapper {

    /**
     * 根据id查询用户信息
     * @param id
     * @return
     */
    public User queryUserById(Long id);

    /**
     * 查询所有用户
     * @return
     */
    public List<User> queryUserAll();

    /**
     * 新增用户
     * @param user
     */
    public void insertUser(User user);

    /**
     * 根据id更新用户
     * @param user
     */
    public void updateUser(User user);

    /**
     * 根据id删除用户信息
     * @param id
     */
    public void deleteUserById(Long id);


    public List<User> queryUserByUserNameLike(@Param("userName") String userName);

    public List<User> queryUserByUserNameLikeIf(@Param("userName") String userName);

    public List<User> queryUserByUserNameLikeChoose(@Param("userName")String userName,@Param("password")String password);

    public User login(@Param("userName")String userName,@Param("password")String password);

    public List<User> queryUserNameAndAge(@Param("userName")String userName,@Param("age")Integer age);

    public void updateUserSelective(@Param("userName") String userName,@Param("password") String password,@Param("id") Long id);

    public List<User> queryUserListByIds(@Param("ids")Long[]ids);
}
